BCP.bill.property.SubtablePropertyEditorControl = function(propDescriptor) {
    BCP.bill.property.SubtablePropertyEditorControl.superclass.constructor.call(this, propDescriptor);
};
BCP.bill.property.SubtablePropertyEditorControl.LABEL = "subtableEditor";
BCP.bill.property.SubtablePropertyEditorControl.getID = function(){
    return BCP.bill.property.SubtablePropertyEditorControl.LABEL;
};
COM.util.defineClass(BCP.bill.property.SubtablePropertyEditorControl, ADF.PropertyEditorControl, {
    createControl: function(propDescriptor) {
        var controlString =  '<div class="form-horizontal" style="margin-bottom:5px;"><div class="form-group" style="position: relative;">' +
            '<div class="col-sm-3" style="margin-left: 2px"><label style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap" for="'+propDescriptor.getName()+ '" class="control-label" title="'+propDescriptor.getHint()+'">'+propDescriptor.getTitle()+'</label></div>' +
            '<div class="col-sm-9" style="margin-left: -25px">' +
            '<button class="btn btn-default btn-block" style="text-align: right"><i class="iconfont icon-set2"></i></button>' +
            '</div></div></div>';
        var control = COM.util.HTMLUtil.createELement(controlString);
        this.control = control[0];
    },
    getControl: function() {
        return this.control;
    },
    setValue: function(value) {
        this.value = value;
    },
    getValue: function() {
        return this.value;
    },
    bindChangeHandler: function(handler) {
        //按钮打开的高级属性，不需要在平时进行控件和编辑器内容的交互，只需要在打开和关闭的时候有交互即可。这里就利用此时机来初始化按钮的点击事件
        //dialog 关闭的时候，要调用handler来改变模型的属性值
        var that = this;
        COM.util.HTMLUtil.getChildren(this.control, "button").bind('click', function() {
            var modalRenderer = ADF.getModalRenderer(BCP.bill.modalRenderer.SubtableModalRenderer.ID);
            if(modalRenderer){
                modalRenderer.show(that.propDescriptor.getValue(), function(data){
                    var request = new AGEF.ChangeValueRequest();
                    request.setPropertyName(that.propDescriptor.getName());
                    request.setValue(data);
                    handler(request);
                });
            }
        }.bind(this));
    },
    getID : function(){
        return BCP.bill.property.SubtablePropertyEditorControl.LABEL;
    }
});